package com.cy.pj.common.bo;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * @author Cx
 * @stage secondStageOfWeb
 * @creat 2020-11-14 14:19
 * 基于此对象封装数据层返回的数据以及计算的分页信息
 */
@Data
public class PageObject<T> implements Serializable {

    private static final long serialVersionUID = -1000563874827068704L;

    private Integer pageCurrent = 1; /*当前页的页码值*/
    private Integer pageSize = 3; /*页面大小*/
    private Integer rowCount = 0; /*总行数(通过查询获得)*/
    private Integer pageCount = 0;  /*总页数(通过计算获得)*/
    private List<T> records; /*当前页记录*/

    public PageObject() {
    }

    public PageObject(Integer pageCurrent, Integer pageSize, Integer rowCount, List<T> records) {
        super();
        this.pageCurrent = pageCurrent;
        this.pageSize = pageSize;
        this.rowCount = rowCount;
        this.records = records;
        this.pageCount = (rowCount - 1) / pageSize + 1;
    }

}
